//**********************************************************************
//	File:			SGD_Handle.h
//	Author:			Doug Monroe
//	Last Modified:	12/5/12
//
//	Purpose:		Store a unique value to identify the location
//					of an element
//
//**********************************************************************

#ifndef SGD_HANDLE_H
#define SGD_HANDLE_H


//namespace SGD
//{
	class CHandle
	{
	public:		
		CHandle( void )								: m_ulHandle( 0 )	{	}					// default constructor

		bool operator == ( const CHandle& h ) const	{	return m_ulHandle == h.m_ulHandle;	}	// comparison for equality
		bool operator != ( const CHandle& h ) const	{	return m_ulHandle != h.m_ulHandle;	}	// comparison for inequality
		bool operator <  ( const CHandle& h ) const	{	return m_ulHandle <  h.m_ulHandle;	}	// comparison for less than

	private:
		unsigned long	m_ulHandle;																// DATA

		CHandle( unsigned long h )					: m_ulHandle( h )	{	}					// overloaded constructor
		CHandle& operator= ( unsigned long h )		{	m_ulHandle = h;	return *this;	}		// assignment operator
		
		template< typename DataType >
		friend class CHandleManager;

		friend class CHandleDecoder;
	};

	
	const CHandle INVALID_HANDLE;


	class HTexture	: private CHandle	
	{
	public:
		HTexture( const CHandle& h = CHandle() )	: CHandle( h )	{	}

		// Comparison operators
		bool operator == ( const HTexture& h ) const	{	return CHandle(*this) == CHandle(h);}	// comparison for equality
		bool operator != ( const HTexture& h ) const	{	return CHandle(*this) != CHandle(h);}	// comparison for inequality
		bool operator <  ( const HTexture& h ) const	{	return CHandle(*this) <  CHandle(h);}	// comparison for less than
						 
		// Comparison operators for parent type
		bool operator == ( const CHandle&  h ) const	{	return CHandle(*this) == h;			}	// comparison for equality
		bool operator != ( const CHandle&  h ) const	{	return CHandle(*this) != h;			}	// comparison for inequality
		bool operator <  ( const CHandle&  h ) const	{	return CHandle(*this) <  h;			}	// comparison for less than

		friend class CGraphics;
	};

	class HAudio	: private CHandle	
	{
	public:
		HAudio( const CHandle& h = CHandle() )		: CHandle( h )	{	}

		// Comparison operators
		bool operator == ( const HAudio&   h ) const	{	return CHandle(*this) == CHandle(h);}	// comparison for equality
		bool operator != ( const HAudio&   h ) const	{	return CHandle(*this) != CHandle(h);}	// comparison for inequality
		bool operator <  ( const HAudio&   h ) const	{	return CHandle(*this) <  CHandle(h);}	// comparison for less than

		// Comparison operators for parent type
		bool operator == ( const CHandle&  h ) const	{	return CHandle(*this) == h;			}	// comparison for equality
		bool operator != ( const CHandle&  h ) const	{	return CHandle(*this) != h;			}	// comparison for inequality
		bool operator <  ( const CHandle&  h ) const	{	return CHandle(*this) <  h;			}	// comparison for less than
		
		friend class CAudio;
	};

//}	// namespace SGD

#endif //SGD_HANDLE_H
